Skip to content

Share generated interface member descriptors - #97

Closed
leileizhang (lei9444) wants to merge 8 commits into
mainfrom
perf/shared-interface-members
Closed

Share generated interface member descriptors#97
leileizhang (lei9444) wants to merge 8 commits into
mainfrom
perf/shared-interface-members

Conversation

@lei9444

@lei9444 leileizhang (lei9444) commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add the opt-in --shared-interface-members JavaScript codegen flag.
  • Reuse canonical required-interface prototype descriptors on compatible concrete classes.
  • Keep conflicts, overloads, ambiguous interface identities, and one-off interfaces class-local.
  • Preserve the default generation path, raw interface APIs, deep imports, and mixed-flag incremental safety.

Compatibility

The implementation uses one canonical interface identity for source emission and descriptor copying. It falls back to class-local members for ambiguous flat filenames and rejects incompatible incremental overwrites.

When sharing replaces an inline raw-interface declaration, the class deep module preserves the same public JS/TypeScript import through an equivalent canonical re-export. Declaration APIs and import paths are preserved, but flag-on .d.ts files are not byte-identical. Flag-off/default output remains byte-compatible.

The option is JavaScript-only and disabled by default.

Corrected isolated Gallery A/B

Measured with the latest branch, the same 32 Gallery WinMDs and 99 references, and no bundle post-processing:

Metric Baseline Shared Delta
Total generated JS 48,563,986 B 48,335,321 B -0.47%
Per-type JS 48,287,170 B 48,058,505 B -0.47%
First-screen closure JS 13,373,627 B 13,568,182 B +1.45%
First-screen closure modules 882 952 +70
DTS bytes 11,006,778 B 10,880,821 B -1.14%
Static require edges 27,963 28,257 +294
Cyclic SCCs 39 59 +20

File sets and all 2,781 root exports are preserved. Deep modules lose no baseline exports; two modules gain canonical raw-interface re-exports. TypeScript root/deep import validation passes and unsafe copied sources are zero.

Validation

  • Default JS/Python output matches the base branch.
  • Uri deep IStringable JS/DTS imports are preserved, including Node 22 ESM named imports.
  • Shared-to-unflagged incremental generation preserves existing source markers.
  • Duplicate same-name TypeDefs retain distinct IIDs for ambiguity planning.
  • Gallery Binding/Router smoke and E2E: 37/37 passed.
  • Full cargo test -p dynwinrt-codegen passed.

Recommendation

Correctness and compatibility issues are resolved, but the final measured benefit is negligible and the first-screen dependency graph becomes larger and more cyclic. Based on the current data, this change does not provide enough value to justify merging in its present form.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 84688dea-d965-4933-a2d9-41f8f6ad2f2e
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b485b75e-2292-44e1-98c8-3f7bb6489bff
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b485b75e-2292-44e1-98c8-3f7bb6489bff
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b485b75e-2292-44e1-98c8-3f7bb6489bff
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

Mixed-language test coverage

Workflow status: ✅ Passed

Layer Lines Functions Branches/regions
Rust, including native .pyd/.node 81.05% 77.58% 81.02% regions
Generated Python projections 77.01% n/a 62.35% branches
JavaScript aggregate 18.21% 19.53% 50.72% branches
JavaScript runtime 19.36% 14.28% 7.14% branches
Generated WinRT projections 22.3% 19.96% 52.8% branches
Generated Classic COM projections 11.25% 18.08% 45.94% branches

View workflow run and download full HTML/LCOV/XML reports

leileizhang (lei9444) and others added 4 commits August 12, 2026 22:34
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b485b75e-2292-44e1-98c8-3f7bb6489bff
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 84688dea-d965-4933-a2d9-41f8f6ad2f2e
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b485b75e-2292-44e1-98c8-3f7bb6489bff
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b485b75e-2292-44e1-98c8-3f7bb6489bff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant